package com.example.demo.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.HashMap;
import java.util.Map;

@Controller
public class HomeController {

    @GetMapping("/")
    public String Index(Model model) {
        model.addAttribute("welcome", "hello springboot!");
        return "home/index";
    }

    @GetMapping("/welcome")
    public String Welcome(ModelMap modelMap) {
        Map<String, String> map = new HashMap<>();
        map.put("name", "姓名");
        map.put("desc", "描述");
        modelMap.addAttribute("user", map);
        return "home/welcome";
    }
}
